import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'dialog_data.dart';

class JRDialogWithType3 extends StatelessWidget {
  final TextWithVerticalBtnDialogData data;

  const JRDialogWithType3({Key? key, required this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(16.w),
      ),
      width: 280.w,
      padding: EdgeInsets.symmetric(horizontal: 24.w),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          SizedBox(
            height: 24.h,
          ),
          Text(
            data.title,
            textAlign: TextAlign.center,
            style: TextStyle(
              fontSize: 16.sp,
              fontWeight: FontWeight.w600,
              color: Color(0xff333333),
              height: 18 / 18,
            ),
          ),
          SizedBox(
            height: 12.h,
          ),
          data.descWidget??Text(
            data.desc,
            textAlign: TextAlign.center,
            style: TextStyle(
              fontSize: 13.sp,
              fontWeight: FontWeight.w400,
              color: Color(0xff666666),
              height: 22 / 14,
            ),
          ),
          SizedBox(
            height: 24.h,
          ),
          CupertinoButton(
            onPressed: () async{
              if ((await data.onFirstBtnPress?.call()) ?? true) {
                Navigator.pop(context,true);
              }
            },
            minSize: 0,
            padding: EdgeInsets.zero,
            child: Container(
              height: 40.h,
              decoration: const ShapeDecoration(
                color: Color(0xffffd400),
                shape: StadiumBorder(),
              ),
              alignment: Alignment.center,
              child: Text(
                data.firstBtnText,
                style: TextStyle(
                  fontSize: 16.sp,
                  fontWeight: FontWeight.w600,
                  color: Color(0xff333333),
                  height: 15 / 15,
                ),
              ),
            ),
          ),
          SizedBox(height: 20.h,),
          CupertinoButton(
            onPressed: () async{
              if ((await data.onSecondBtnPress?.call()) ?? true) {
                Navigator.pop(context,false);
              }
            },
            minSize: 0,
            padding: EdgeInsets.zero,
            child: Text(
              data.secondBtnText,
              style: TextStyle(
                fontSize: 16.sp,
                fontWeight: FontWeight.w400,
                color: Color(0xff666666),
                height: 15 / 15,
              ),
            ),
          ),
          SizedBox(
            height: 24.h,
          ),
        ],
      ),
    );
  }
}
